nice_things/lang/quote.sh
quote
Since 0.3.0 · Source
import "{ quote }" from nice_things/lang/quote.sh
Synopsisquote <out_var> [<string>…]
Configuration
–
Description
Quote <string> arguments to make them safe to eval; assign to <out_var> as a quoted list separated by a space character.
For streaming use-cases, when you want to read text from stdin and print quoted text to stdout, in a pipeline, check out the escape_single_quotes function.
Options
–
Operands
<out_var>: Output variable; the result will be written to this variable.<string>: A value to be quoted.
Stdin
–
Stdout
–
Stderr
–
Exit status0: Successful completion.
Abort
–
Usage examples
# Save quoted arguments in a variable
quote NS__arguments "$@"
# Restore arguments from quoted variable
eval " set -- ${NS__arguments}"